package com.example.myprovider;

import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;

public class MyDao {
    private Context context;
    private SQLiteDatabase database;
    public  MyDao(Context context){
        this.context=context;
        MyDBHelper dBHelper=new MyDBHelper(context,"hmwDB",null,1);
        database=dBHelper.getWritableDatabase();
    }

    public Uri DAOinsert(ContentValues contentValues){
        long rowid = database.insert("student",null,contentValues);
        Uri uri=Uri.parse("content://hmw.provider2");
        Uri inserturi = ContentUris.withAppendedId(uri,rowid);
        context.getContentResolver().notifyChange(inserturi,null);
        return inserturi;
    }
}
